package com.yyfax.pay.third.model.to.fuiou;

import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.io.xml.QNameMap;
import com.thoughtworks.xstream.io.xml.StaxDriver;
import com.yyfax.pay.common.constants.FuiouProtocolPayConstant;

import java.io.Serializable;

@XStreamAlias("RESPONSE")
public class BindMsgRsp implements Serializable {

    @XStreamAlias("VERSION")
    private String version;

    @XStreamAlias("RESPONSECODE")
    private String respCode;

    @XStreamAlias("RESPONSEMSG")
    private String respMsg;

    @XStreamAlias("MCHNTSSN")
    private String orderId;

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getRespCode() {
        return respCode;
    }

    public void setRespCode(String respCode) {
        this.respCode = respCode;
    }

    public String getRespMsg() {
        return respMsg;
    }

    public void setRespMsg(String respMsg) {
        this.respMsg = respMsg;
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public static BindMsgRsp fromXml(String xml) {
        QNameMap qmap = new QNameMap();
        qmap.setDefaultPrefix("");
        StaxDriver staxDriver = new StaxDriver(qmap);
        XStream xstream = new XStream(staxDriver);
        xstream.autodetectAnnotations(true);
        xstream.ignoreUnknownElements();
        xstream.alias(FuiouProtocolPayConstant.RESPONSE, BindMsgRsp.class);
        return (BindMsgRsp) xstream.fromXML(xml);
    }
}
